﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.oracle;

namespace SharpSqlAnalyzer.stmt.oracle
{
	// Token: 0x02000135 RID: 309
	public class TPlsqlCreateFunction : TCommonStoredProcedureSqlStatement
	{
		// Token: 0x170001C7 RID: 455
		// (get) Token: 0x060009F6 RID: 2550 RVA: 0x00304178 File Offset: 0x00302378
		// (set) Token: 0x060009F7 RID: 2551 RVA: 0x00304180 File Offset: 0x00302380
		public virtual TObjectName ImplementionType
		{
			get
			{
				return this.implementionType;
			}
			set
			{
				this.implementionType = value;
			}
		}

		// Token: 0x170001C8 RID: 456
		// (get) Token: 0x060009F8 RID: 2552 RVA: 0x00304189 File Offset: 0x00302389
		// (set) Token: 0x060009F9 RID: 2553 RVA: 0x00304191 File Offset: 0x00302391
		public virtual bool Deterministic
		{
			get
			{
				return this.isDeterministic;
			}
			set
			{
				this.isDeterministic = value;
			}
		}

		// Token: 0x170001C9 RID: 457
		// (get) Token: 0x060009FA RID: 2554 RVA: 0x0030419A File Offset: 0x0030239A
		// (set) Token: 0x060009FB RID: 2555 RVA: 0x003041A2 File Offset: 0x003023A2
		public virtual TParallelEnableClause ParallelEnableClause
		{
			get
			{
				return this.parallelEnableClause;
			}
			set
			{
				this.parallelEnableClause = value;
			}
		}

		// Token: 0x170001CA RID: 458
		// (get) Token: 0x060009FC RID: 2556 RVA: 0x003041AB File Offset: 0x003023AB
		// (set) Token: 0x060009FD RID: 2557 RVA: 0x003041B3 File Offset: 0x003023B3
		public virtual TResultCacheClause ResultCacheClause
		{
			get
			{
				return this.resultCacheClause;
			}
			set
			{
				this.resultCacheClause = value;
			}
		}

		// Token: 0x170001CB RID: 459
		// (get) Token: 0x060009FE RID: 2558 RVA: 0x003041BC File Offset: 0x003023BC
		// (set) Token: 0x060009FF RID: 2559 RVA: 0x003041C4 File Offset: 0x003023C4
		public virtual TInvokerRightsClause InvokerRightsClause
		{
			get
			{
				return this.invokerRightsClause;
			}
			set
			{
				this.invokerRightsClause = value;
			}
		}

		// Token: 0x170001CC RID: 460
		// (get) Token: 0x06000A00 RID: 2560 RVA: 0x003041CD File Offset: 0x003023CD
		public override TObjectName StoredProcedureName
		{
			get
			{
				return this.functionName;
			}
		}

		// Token: 0x170001CD RID: 461
		// (get) Token: 0x06000A01 RID: 2561 RVA: 0x003041D5 File Offset: 0x003023D5
		// (set) Token: 0x06000A02 RID: 2562 RVA: 0x003041DD File Offset: 0x003023DD
		public virtual TObjectName FunctionName
		{
			get
			{
				return this.functionName;
			}
			set
			{
				this.functionName = value;
			}
		}

		// Token: 0x170001CE RID: 462
		// (get) Token: 0x06000A03 RID: 2563 RVA: 0x003041E6 File Offset: 0x003023E6
		// (set) Token: 0x06000A04 RID: 2564 RVA: 0x003041EE File Offset: 0x003023EE
		public virtual int Kind
		{
			get
			{
				return this.kind;
			}
			set
			{
				this.kind = value;
			}
		}

		// Token: 0x06000A05 RID: 2565 RVA: 0x003041F7 File Offset: 0x003023F7
		public TPlsqlCreateFunction(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstplsql_createfunction;
		}

		// Token: 0x170001CF RID: 463
		// (get) Token: 0x06000A06 RID: 2566 RVA: 0x0030420F File Offset: 0x0030240F
		// (set) Token: 0x06000A07 RID: 2567 RVA: 0x00304217 File Offset: 0x00302417
		public virtual TCallSpec CallSpec
		{
			get
			{
				return this.callSpec;
			}
			set
			{
				this.callSpec = value;
			}
		}

		// Token: 0x06000A08 RID: 2568 RVA: 0x00304220 File Offset: 0x00302420
		internal override void buildsql()
		{
		}

		// Token: 0x06000A09 RID: 2569 RVA: 0x00304222 File Offset: 0x00302422
		internal override void clear()
		{
		}

		// Token: 0x06000A0A RID: 2570 RVA: 0x00304224 File Offset: 0x00302424
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000A0B RID: 2571 RVA: 0x0030422B File Offset: 0x0030242B
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x06000A0C RID: 2572 RVA: 0x00304230 File Offset: 0x00302430
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			if (this.Wrapped)
			{
				return 0;
			}
			TCreateFunctionSqlNode tcreateFunctionSqlNode = (TCreateFunctionSqlNode)this.rootNode;
			if (base.doParseStatement(psql) != 0)
			{
				return -1;
			}
			this.functionName = tcreateFunctionSqlNode.FunctionName;
			base.DatabaseObjects.Add(this.functionName);
			this.ParameterDeclarations = tcreateFunctionSqlNode.Parameters;
			this.returnDataType = tcreateFunctionSqlNode.ReturnDataType;
			this.invokerRightsClause = tcreateFunctionSqlNode.InvokerRightsClause;
			this.isDeterministic = tcreateFunctionSqlNode.Deterministic;
			this.parallelEnableClause = tcreateFunctionSqlNode.ParallelEnableClause;
			this.resultCacheClause = tcreateFunctionSqlNode.ResultCacheClause;
			this.implementionType = tcreateFunctionSqlNode.ImplementionType;
			this.callSpec = tcreateFunctionSqlNode.CallSpec;
			this.LabelName = tcreateFunctionSqlNode.LabelName;
			this.EndLabelName = tcreateFunctionSqlNode.EndLabelName;
			if (this.ParameterDeclarations != null)
			{
				for (int i = 0; i < this.ParameterDeclarations.size(); i++)
				{
					this.TopStatement.SymbolTable.Push(new TSymbolTableItem(9, this, this.ParameterDeclarations.getParameterDeclarationItem(i)));
				}
			}
			if (tcreateFunctionSqlNode.DeclareStmts != null)
			{
				tcreateFunctionSqlNode.DeclareStmts.doParse(this, ESqlClause.unknown);
				for (int j = 0; j < tcreateFunctionSqlNode.DeclareStmts.size(); j++)
				{
					this.TopStatement.SymbolTable.Push(new TSymbolTableItem(10, this, tcreateFunctionSqlNode.DeclareStmts.getStatementSqlNode(j).Stmt));
					this.DeclareStatements.add(tcreateFunctionSqlNode.DeclareStmts.getStatementSqlNode(j).Stmt);
				}
			}
			if (tcreateFunctionSqlNode.Stmts != null)
			{
				tcreateFunctionSqlNode.Stmts.doParse(this, ESqlClause.unknown);
				for (int k = 0; k < tcreateFunctionSqlNode.Stmts.size(); k++)
				{
					this.BodyStatements.add(tcreateFunctionSqlNode.Stmts.getStatementSqlNode(k).Stmt);
				}
			}
			if (tcreateFunctionSqlNode.ExceptionClause != null)
			{
				tcreateFunctionSqlNode.ExceptionClause.doParse(this, ESqlClause.unknown);
				this.ExceptionClause = tcreateFunctionSqlNode.ExceptionClause;
			}
			if (tcreateFunctionSqlNode.DeclareStmts != null)
			{
				for (int l = 0; l < tcreateFunctionSqlNode.DeclareStmts.size(); l++)
				{
					this.TopStatement.SymbolTable.Pop();
				}
			}
			if (this.ParameterDeclarations != null)
			{
				for (int m = 0; m < this.ParameterDeclarations.size(); m++)
				{
					this.TopStatement.SymbolTable.Pop();
				}
			}
			return 0;
		}

		// Token: 0x06000A0D RID: 2573 RVA: 0x0030447E File Offset: 0x0030267E
		public override void init(object arg1)
		{
		}

		// Token: 0x170001D0 RID: 464
		// (get) Token: 0x06000A0F RID: 2575 RVA: 0x00304489 File Offset: 0x00302689
		// (set) Token: 0x06000A0E RID: 2574 RVA: 0x00304480 File Offset: 0x00302680
		public virtual TTypeName ReturnDataType
		{
			get
			{
				return this.returnDataType;
			}
			set
			{
				this.returnDataType = value;
			}
		}

		// Token: 0x06000A10 RID: 2576 RVA: 0x00304491 File Offset: 0x00302691
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000A11 RID: 2577 RVA: 0x003044A4 File Offset: 0x003026A4
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.ParameterDeclarations != null)
			{
				this.ParameterDeclarations.acceptChildren(v);
			}
			if (this.DeclareStatements.size() > 0)
			{
				this.DeclareStatements.acceptChildren(v);
			}
			if (this.BodyStatements.size() > 0)
			{
				this.BodyStatements.acceptChildren(v);
			}
			if (this.ExceptionClause != null)
			{
				this.ExceptionClause.acceptChildren(v);
			}
			v.postVisit(this);
		}

		// Token: 0x04001266 RID: 4710
		private bool isDeterministic;

		// Token: 0x04001267 RID: 4711
		private TInvokerRightsClause invokerRightsClause;

		// Token: 0x04001268 RID: 4712
		private TParallelEnableClause parallelEnableClause;

		// Token: 0x04001269 RID: 4713
		private TResultCacheClause resultCacheClause;

		// Token: 0x0400126A RID: 4714
		private TObjectName implementionType;

		// Token: 0x0400126B RID: 4715
		private TObjectName functionName;

		// Token: 0x0400126C RID: 4716
		private int kind = 1;

		// Token: 0x0400126D RID: 4717
		private TCallSpec callSpec;

		// Token: 0x0400126E RID: 4718
		private TTypeName returnDataType;
	}
}
